package eco2automotive.gui.components;
import eco2automotive.port.Connection;
import java.awt.*;
import javax.swing.*;
/** 
  * JPanel display the information of configuration to use by the port.
  * @version 1.0
  * @autor Fco. Javier Sánchez Esparza
 */
public class Panel_PORT_INFO extends JPanel{

private JLabel jbl_portName;
private JLabel jbl_velocidad;
private JLabel jbl_dataBits;
private JLabel jbl_stopBits;
private JLabel jbl_paridad;
private JLabel jbl_timeout;
private JLabel jbl_flowControlMode;     
private JTextField jtxt_portName;
private JTextField jtxt_velocidad;
private JTextField jtxt_dataBits;
private JTextField jtxt_stopBits;
private JTextField jtxt_paridad;
private JTextField jtxt_timeout;
private JTextField jtxt_flowControlMode;  

/**
 * Panel, display the Connection values.
 * @see eco2automotive.port.Connection
 * @param CONN
 */
public Panel_PORT_INFO(Connection CONN){
        
    setBorder(new javax.swing.border.TitledBorder("Port Information"));  
        jbl_portName=new JLabel("Port Name");
            jtxt_portName=new JTextField();
            jtxt_portName.setText(String.valueOf(CONN.getNombrePuerto()));
            jtxt_portName.setEditable(false);       
        jbl_velocidad=new JLabel("Velocity");
            jtxt_velocidad=new JTextField();
            jtxt_velocidad.setText(String.valueOf(CONN.getBaud()));
            jtxt_velocidad.setEditable(false);
        jbl_dataBits=new JLabel("DataBits");
            jtxt_dataBits=new JTextField();
            jtxt_dataBits.setText(String.valueOf(CONN.getDataBits()));
            jtxt_dataBits.setEditable(false);
        jbl_stopBits=new JLabel("Stop Bits");
            jtxt_stopBits=new JTextField();
            jtxt_stopBits.setText(String.valueOf(CONN.getStopBits()));
            jtxt_stopBits.setEditable(false);            
        jbl_paridad=new JLabel("Parity");
            jtxt_paridad=new JTextField();
            jtxt_paridad.setText(String.valueOf(CONN.getParity()));
            jtxt_paridad.setEditable(false);
        jbl_timeout=new JLabel("TimeOut");
            jtxt_timeout=new JTextField();
            jtxt_timeout.setEditable(false);
            jtxt_timeout.setText(String.valueOf(CONN.getTimeOut()));
        jbl_flowControlMode=new JLabel("Flow Control");
            jtxt_flowControlMode=new JTextField();
            jtxt_flowControlMode.setEditable(false);
            jtxt_flowControlMode.setText(String.valueOf(CONN.getFlowControlMode()));

       this.setLayout (new GridLayout(7,2,2,2));
       //this.add(new JLabel("Select Port"));this.add(new Panel_PORT_FINDER());
       this.add(jbl_portName);this.add(jtxt_portName);
       this.add(jbl_velocidad);this.add(jtxt_velocidad);
       this.add(jbl_dataBits);this.add(jtxt_dataBits);
       this.add(jbl_stopBits);this.add(jtxt_stopBits);
       this.add(jbl_paridad);this.add(jtxt_paridad);
       this.add(jbl_timeout);this.add(jtxt_timeout);
       this.add(jbl_flowControlMode);this.add(jtxt_flowControlMode);       
   
    }
/**
 * 
 * @param s
 */
public void setPortName(String s){this.jtxt_portName.setText(s);}
    
}
